package com.sf.algo.solve.domain;

import org.optaplanner.core.api.domain.entity.PlanningEntity;
import org.optaplanner.core.api.domain.variable.AnchorShadowVariable;
import org.optaplanner.core.api.domain.variable.PlanningVariable;
import org.optaplanner.core.api.domain.variable.PlanningVariableGraphType;

@PlanningEntity
public class Goods extends LongIdBean implements Standstill {

	private Location location;

	private int value;

	@PlanningVariable(graphType = PlanningVariableGraphType.CHAINED, valueRangeProviderRefs = { "personRange",
			"goodsRange" })
	private Standstill previous;

	@AnchorShadowVariable(sourceVariableName = "previous")
	private Person person;

	private Goods next;

	public Location getLocation() {
		return location;
	}

	public Standstill getPrevious() {
		return previous;
	}

	public void setPrevious(Standstill previous) {
		this.previous = previous;
	}

	public void setPerson(Person person) {
		this.person = person;
	}

	public void setLocation(Location location) {
		this.location = location;
	}

	public int getValue() {
		return value;
	}

	public void setValue(int value) {
		this.value = value;
	}

	@Override
	public Person getPerson() {
		return person;
	}

	@Override
	public Goods getNext() {
		return next;
	}

	@Override
	public void setNext(Goods next) {
		this.next = next;
	}
	
	@Override
	public String toString() {
		return String.format("%s<%s,%s>", getClass().getSimpleName(), id, location);
	}

}
